import React from 'react'
import { useDispatch,useSelector } from 'react-redux/es/exports'
import { getMovseAction } from "../../store/slice/movieSlice";



export default function Movie() {
    const dispatch = useDispatch()
    
    const count = useSelector(state=>state.count.count)

    const movieList = useSelector(state=>state.movie.movieList)

    const getMovieHandle=()=>[
        dispatch(getMovseAction())
    ]
    return(
        <div>
            <h1>我是movie组件</h1>
            <h2>我拿到的count组件的值是{count}</h2>
            <button onClick={getMovieHandle}>获取电影的数据</button>
            <ul>
                {
                    movieList.map(item=>{
                        return <li key={item.tvId}>{item.albumName}</li>
                    })
                }
            </ul>
        </div>
    )
}
